<%
sDomain = Request.QueryString("Domain")
sGroupSelected = Request.QueryString("Group")
sUserSelected = Request.QueryString("User")

'SUPPLY YOUR OWN DOMAIN HERE
if sDomain = "" then sDomain = "PREMIER-GLOBAL"
bListGroups = (sGroupSelected = "")
bListUsers =  (sGroupSelected <> "") and sUserSelected = ""
bUserInfo = sUserSelected <> ""

%>
<HTML>
<HEAD>
<TITLE>ADSI/ASP Example</TITLE>
</HEAD>
<BODY>

<% 
Dim i
for i = 1 to Cint(Request("Incr")) %>
<%= i & ". " & Request("TETime"&i) & "  " %>

<%= Request("TEEvent"&i) %>
<br>
<% next %>

<% if bListGroups then %>
<B>Groups in Domain <I><%= sDomain %></I></B><P>
<% 
Set objDomain = GetObject("WinNT://" & sDomain)
	
For Each objMember in objDomain
	If objMember.Class = "Group" Then
		sGroup = objMember.Name
		response.write "<A HREF = 'NTTest.asp?Group=" & sGroup & "&Domain=" & sDomain & "'>"
		response.write sGroup & "</A><BR>"
		End if
	Next

elseif bListUsers then  'Group Info Selected

%>
	<B>Users in Group <I><%= sGroupSelected %></I></B><P>
	<% Set objGroup = GetObject("WinNT://" & sDomain & "/" & sGroupSelected)
	For Each objMember in objGroup.Members

		On Error Resume Next


		If objMember.Class = "User" Then
		
			sUser = objMember.Name
			sUsers = sUsers & "<b><a href='NTTest.asp?"
			sUsers = sUsers & "Group=" & sGroupSelected
			sUsers = sUsers & "&Domain=" & sDomain 
			sUsers = sUsers & "&User=" & Server.URLEncode(sUser)
			sUsers = sUsers & "'>" & sUser & "</a></b><br>"
			
		End If
			
	Next

	if sUsers = "" then response.write "This Group has no Users."
	response.write sUsers
	

ElseIf bUserInfo Then 'User Info Selected

%>
<B>User <I><%=sUserSelected %></I></B><P>
<%
On Error Resume Next
	set objGroup = GetObject("WinNT://" & sDomain & "/" & sGroupSelected)

	For Each objUser in objGroup.Members
	
		If objUser.Class = "User" and objUser.Name = sUserSelected Then

			sUserInfo = sUserInfo & "Full Name: " & objUser.FullName & "<br>"
			sUserInfo = sUserInfo & "First Name: " & objUser.givenName & "<br>"
			sUserInfo = sUserInfo & "Description: " & objUser.Description & "<br>"
			sUserInfo = sUserInfo & "Account Disabled: " & objUser.AccountDisabled & "<br>"
			sUserInfo = sUserInfo & "<p>"
			
			Exit For

		End If
		Next
			
		if sUserInfo = "" then sUserInfo =  "Information About this user is Not Available."
		response.write sUserInfo

Else 'Invalid
	Response.Write "Invalid data. <A HREF = 'NTTest.asp'>Try again.</A>."

End if

%><br>

  <br>
<P>
<A HREF = 'NTTest.asp'>Start Page</A><BR>
<A HREF = 'javascript:history.back()'>Back</A>



</BODY>
</HTML>



